package com.aaa.sbms.controller;

import com.aaa.sbms.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @FileName:CourseController
 * @Description:
 * @Author :99728
 * @Date: 2020/6/16 19:47
 * @Version:1.0.0
 */
@RestController
@RequestMapping("course")
public class CourseController {

    @Autowired
    private CourseService courseService;

    /**
     * 分页课程管理
     * @param map
     * @return
     */
    @RequestMapping("page")
    public Object page(@RequestParam Map map){
        return courseService.getPage(map);
    }

    /**
     * 根据Id查询数据
     * @param courseid
     * @return
     */
    @RequestMapping("onelist")
    public Object onelist(Integer courseid){
        return courseService.onelist(courseid);
    }

    /**
     * 添加
     * @param map
     * @return
     */
    @RequestMapping("add")
    public  Object add(@RequestBody Map map){
        return courseService.add(map);
    }

    /**
     * 更新
     * @param map
     * @return
     */
    @RequestMapping("update")
    public Object update(@RequestBody Map map){
        return courseService.update(map);
    }

    /**
     * 删除
     * @param courseId
     * @return
     */
    @RequestMapping("delete")
    public Object delete(Integer courseId){
        return courseService.delete(courseId);
    }
}
